package com.example.yuanqin

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.compose.material.MaterialTheme
import com.example.yuanqin.page.login.LoginActivity
import com.example.yuanqin.viewmodel.SplashViewModel
import com.example.yuanqin.viewmodel.SplashViewModelFactory

class SplashActivity : AppCompatActivity() {

    private val viewModel:SplashViewModel by viewModels { SplashViewModelFactory() }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent{
            MaterialTheme {
                splash(waitTime = 5) { event ->
                    when (event) {
                        SplashEvent.JumpMainPage -> {
                            jumpMainPage()
                        }
                    }
                }
            }
        }
    }

    private fun jumpMainPage(){
        startActivity(Intent(this,LoginActivity::class.java))
        finish()
    }

}

const val TAG:String = "TestLogTag"